package b.h.z.db;

import java.sql.Connection;
import java.sql.SQLException;

import b.h.z.vo.ArgsVO;

import oracle.jdbc.pool.OracleDataSource;

public class ConnectionPool {
	private static OracleDataSource ds;

	private ConnectionPool() {
	}

	public static Connection getConnection(ArgsVO args) throws SQLException {
		try {
			if (ds == null) {
				ds = new OracleDataSource();
				ds.setDriverType("oracle.jdbc.driver.OracleDriver");
				ds.setURL(args.getUrl());
				System.out.println(args.getUrl());
				ds.setUser(args.getUser());
				System.out.println(args.getUser()+"--"+args.getPassword());
				ds.setPassword(args.getPassword());
			}
		} catch (SQLException e) {
			throw e;
		}
		return ds.getConnection();
	}
}
